﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Runtime.Serialization;
using Kinect.Tests;
using System.IO;
using Microsoft.Win32;

namespace TestAnalyzer
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

            //DataContractSerializer s = new DataContractSerializer(typeof(List<TestInfo>));

            //var stream = File.Open("C:\\Temp\\KinectUsabilityTest-21.3.2012 17.12.56.dat", FileMode.Open);
            //var stuff = s.ReadObject(stream);

        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.FileOk += new System.ComponentModel.CancelEventHandler(dialog_FileOk);

            dialog.ShowDialog();

           
   
        }

        void dialog_FileOk(object sender, System.ComponentModel.CancelEventArgs e)
        {
            var dialog = sender as OpenFileDialog;
            var stream = dialog.OpenFile();

            DataContractSerializer s = new DataContractSerializer(typeof(List<TestInfo>));

            //var stream = File.Open("C:\\Temp\\KinectUsabilityTest-21.3.2012 17.12.56.dat", FileMode.Open);
            List<TestInfo> stuff = s.ReadObject(stream) as List<TestInfo>;

            Results results = new Results(stuff);

            results.Show();
        }
    }
}
